//
//  IMCellFactory.m
//  ChatMainDemo
//
//  Created by peiw on 16/1/21.
//  Copyright © 2016年 peiw. All rights reserved.
//

#import "IMCellFactory.h"
#import "IMTextCell.h"
#import "IMImageCell.h"
#import "IMVoiceCell.h"
#import "IMFileCell.h"
#import "IMPromptCell.h"

@implementation IMCellFactory

- (IMBaseCell *)cellForType:(IMMessageType)type identifier:(NSString *)identifier{
    IMBaseCell *cell = nil;
    switch (type) {
        case eTFText:
            cell = [[IMTextCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:identifier];
            break;
        case eTFImage:
            cell = [[IMImageCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:identifier];
            break;
        case eTFVoice:
            cell = [[IMVoiceCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:identifier];
            break;
        case eTFFile:
            cell = [[IMFileCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:identifier];
            break;
        default:
            cell = [[IMPromptCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:identifier];
            break;
    }
    return cell;
}

@end
